3.9.66 \(\int \cos ^2(c+d x) (a+b \sec (c+d x)) (A+B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\) [866]

Optimal. Leaf size=69 \[ \frac {1}{2} (2 b B+a (A+2 C)) x+\frac {b C \tanh ^{-1}(\sin (c+d x))}{d}+\frac {(A b+a B) \sin (c+d x)}{d}+\frac {a A \cos (c+d x) \sin (c+d x)}{2 d} \]

[Out]

1/2*(2*b*B+a*(A+2*C))*x+b*C*arctanh(sin(d*x+c))/d+(A*b+B*a)*sin(d*x+c)/d+1/2*a*A*cos(d*x+c)*sin(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.12, antiderivative size = 69, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 39, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.128, Rules used = {4159, 4132, 8, 4130, 3855} \begin {gather*} \frac {(a B+A b) \sin (c+d x)}{d}+\frac {1}{2} x (a (A+2 C)+2 b B)+\frac {a A \sin (c+d x) \cos (c+d x)}{2 d}+\frac {b C \tanh ^{-1}(\sin (c+d x))}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*(a + b*Sec[c + d*x])*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

((2*b*B + a*(A + 2*C))*x)/2 + (b*C*ArcTanh[Sin[c + d*x]])/d + ((A*b + a*B)*Sin[c + d*x])/d + (a*A*Cos[c + d*x]
*Sin[c + d*x])/(2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4130

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> Simp[A*Cot[e
+ f*x]*((b*Csc[e + f*x])^m/(f*m)), x] + Dist[(C*m + A*(m + 1))/(b^2*m), Int[(b*Csc[e + f*x])^(m + 2), x], x] /
; FreeQ[{b, e, f, A, C}, x] && NeQ[C*m + A*(m + 1), 0] && LeQ[m, -1]

Rule 4132

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(
C_.)), x_Symbol] :> Dist[B/b, Int[(b*Csc[e + f*x])^(m + 1), x], x] + Int[(b*Csc[e + f*x])^m*(A + C*Csc[e + f*x
]^2), x] /; FreeQ[{b, e, f, A, B, C, m}, x]

Rule 4159

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^
(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[A*a*Cot[e + f*x]*((d*Csc[e + f*x])^n/(f*n)), x]
 + Dist[1/(d*n), Int[(d*Csc[e + f*x])^(n + 1)*Simp[n*(B*a + A*b) + (n*(a*C + B*b) + A*a*(n + 1))*Csc[e + f*x]
+ b*C*n*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, d, e, f, A, B, C}, x] && LtQ[n, -1]

Rubi steps

\begin {align*} \int \cos ^2(c+d x) (a+b \sec (c+d x)) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx &=\frac {a A \cos (c+d x) \sin (c+d x)}{2 d}-\frac {1}{2} \int \cos (c+d x) \left (-2 (A b+a B)-(2 b B+a (A+2 C)) \sec (c+d x)-2 b C \sec ^2(c+d x)\right ) \, dx\\ &=\frac {a A \cos (c+d x) \sin (c+d x)}{2 d}-\frac {1}{2} \int \cos (c+d x) \left (-2 (A b+a B)-2 b C \sec ^2(c+d x)\right ) \, dx-\frac {1}{2} (-2 b B-a (A+2 C)) \int 1 \, dx\\ &=\frac {1}{2} (2 b B+a (A+2 C)) x+\frac {(A b+a B) \sin (c+d x)}{d}+\frac {a A \cos (c+d x) \sin (c+d x)}{2 d}+(b C) \int \sec (c+d x) \, dx\\ &=\frac {1}{2} (2 b B+a (A+2 C)) x+\frac {b C \tanh ^{-1}(\sin (c+d x))}{d}+\frac {(A b+a B) \sin (c+d x)}{d}+\frac {a A \cos (c+d x) \sin (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.15, size = 68, normalized size = 0.99 \begin {gather*} \frac {2 a A c+2 a A d x+4 b B d x+4 a C d x+4 b C \tanh ^{-1}(\sin (c+d x))+4 (A b+a B) \sin (c+d x)+a A \sin (2 (c+d x))}{4 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*(a + b*Sec[c + d*x])*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

(2*a*A*c + 2*a*A*d*x + 4*b*B*d*x + 4*a*C*d*x + 4*b*C*ArcTanh[Sin[c + d*x]] + 4*(A*b + a*B)*Sin[c + d*x] + a*A*
Sin[2*(c + d*x)])/(4*d)

________________________________________________________________________________________

Maple [A]
time = 0.09, size = 82, normalized size = 1.19

method result size
derivativedivides \(\frac {A b \sin \left (d x +c \right )+b B \left (d x +c \right )+C b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+a A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+B \sin \left (d x +c \right ) a +a C \left (d x +c \right )}{d}\) \(82\)
default \(\frac {A b \sin \left (d x +c \right )+b B \left (d x +c \right )+C b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+a A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+B \sin \left (d x +c \right ) a +a C \left (d x +c \right )}{d}\) \(82\)
risch \(\frac {a A x}{2}+B b x +a x C -\frac {i A b \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}-\frac {i B a \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {i A b \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {i B a \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{d}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{d}+\frac {a A \sin \left (2 d x +2 c \right )}{4 d}\) \(138\)
norman \(\frac {\left (\frac {1}{2} a A +b B +a C \right ) x +\left (\frac {1}{2} a A +b B +a C \right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {\left (a A +2 A b +2 B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {\left (3 a A -2 A b -2 B a \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\left (-a A -2 b B -2 a C \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {\left (a A -2 A b -2 B a \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {\left (3 a A +2 A b +2 B a \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}+\frac {C b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {C b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(244\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(A*b*sin(d*x+c)+b*B*(d*x+c)+C*b*ln(sec(d*x+c)+tan(d*x+c))+a*A*(1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c)+B*
sin(d*x+c)*a+a*C*(d*x+c))

________________________________________________________________________________________

Maxima [A]
time = 0.28, size = 89, normalized size = 1.29 \begin {gather*} \frac {{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a + 4 \, {\left (d x + c\right )} C a + 4 \, {\left (d x + c\right )} B b + 2 \, C b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a \sin \left (d x + c\right ) + 4 \, A b \sin \left (d x + c\right )}{4 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

1/4*((2*d*x + 2*c + sin(2*d*x + 2*c))*A*a + 4*(d*x + c)*C*a + 4*(d*x + c)*B*b + 2*C*b*(log(sin(d*x + c) + 1) -
 log(sin(d*x + c) - 1)) + 4*B*a*sin(d*x + c) + 4*A*b*sin(d*x + c))/d

________________________________________________________________________________________

Fricas [A]
time = 3.59, size = 73, normalized size = 1.06 \begin {gather*} \frac {{\left ({\left (A + 2 \, C\right )} a + 2 \, B b\right )} d x + C b \log \left (\sin \left (d x + c\right ) + 1\right ) - C b \log \left (-\sin \left (d x + c\right ) + 1\right ) + {\left (A a \cos \left (d x + c\right ) + 2 \, B a + 2 \, A b\right )} \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*(((A + 2*C)*a + 2*B*b)*d*x + C*b*log(sin(d*x + c) + 1) - C*b*log(-sin(d*x + c) + 1) + (A*a*cos(d*x + c) +
2*B*a + 2*A*b)*sin(d*x + c))/d

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sec {\left (c + d x \right )}\right ) \left (A + B \sec {\left (c + d x \right )} + C \sec ^{2}{\left (c + d x \right )}\right ) \cos ^{2}{\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)**2),x)

[Out]

Integral((a + b*sec(c + d*x))*(A + B*sec(c + d*x) + C*sec(c + d*x)**2)*cos(c + d*x)**2, x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 159 vs. \(2 (65) = 130\).
time = 0.49, size = 159, normalized size = 2.30 \begin {gather*} \frac {2 \, C b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 2 \, C b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + {\left (A a + 2 \, C a + 2 \, B b\right )} {\left (d x + c\right )} - \frac {2 \, {\left (A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, B a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, A b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, B a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, A b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(2*C*b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 2*C*b*log(abs(tan(1/2*d*x + 1/2*c) - 1)) + (A*a + 2*C*a + 2*B*
b)*(d*x + c) - 2*(A*a*tan(1/2*d*x + 1/2*c)^3 - 2*B*a*tan(1/2*d*x + 1/2*c)^3 - 2*A*b*tan(1/2*d*x + 1/2*c)^3 - A
*a*tan(1/2*d*x + 1/2*c) - 2*B*a*tan(1/2*d*x + 1/2*c) - 2*A*b*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 + 1
)^2)/d

________________________________________________________________________________________

Mupad [B]
time = 4.11, size = 156, normalized size = 2.26 \begin {gather*} \frac {A\,b\,\sin \left (c+d\,x\right )}{d}+\frac {B\,a\,\sin \left (c+d\,x\right )}{d}+\frac {A\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,B\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,C\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,C\,b\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {A\,a\,\sin \left (2\,c+2\,d\,x\right )}{4\,d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^2*(a + b/cos(c + d*x))*(A + B/cos(c + d*x) + C/cos(c + d*x)^2),x)

[Out]

(A*b*sin(c + d*x))/d + (B*a*sin(c + d*x))/d + (A*a*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*B*b*ata
n(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*C*a*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*C*b*a
tanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (A*a*sin(2*c + 2*d*x))/(4*d)

________________________________________________________________________________________